const { DataTypes } = require('sequelize')
module.exports = sequelize => {
  const attributes = {
    id: {
      type: DataTypes.BIGINT,
      allowNull: false,
      defaultValue: null,
      primaryKey: true,
      autoIncrement: true,
      comment: null,
      field: 'id',
    },
    main_id: {
      type: DataTypes.BIGINT,
      allowNull: true,
      defaultValue: null,
      primaryKey: false,
      autoIncrement: false,
      comment: '主表id',
      field: 'main_id',
    },
    longitude: {
      type: DataTypes.STRING(255),
      allowNull: true,
      defaultValue: null,
      primaryKey: false,
      autoIncrement: false,
      comment: '经度',
      field: 'longitude',
    },
    dimension: {
      type: DataTypes.STRING(255),
      allowNull: true,
      defaultValue: null,
      primaryKey: false,
      autoIncrement: false,
      comment: '维度',
      field: 'dimension',
    },
    del_flag: {
      type: DataTypes.INTEGER(1),
      allowNull: true,
      defaultValue: '0',
      primaryKey: false,
      autoIncrement: false,
      comment: '删除标记（0:未删除 1:已删除）',
      field: 'del_flag',
    },
    create_time: {
      type: DataTypes.DATE,
      allowNull: true,
      defaultValue: sequelize.literal('CURRENT_TIMESTAMP'),
      primaryKey: false,
      autoIncrement: false,
      comment: '创建时间',
      field: 'create_time',
    },
    update_time: {
      type: DataTypes.DATE,
      allowNull: true,
      defaultValue: sequelize.literal('CURRENT_TIMESTAMP'),
      primaryKey: false,
      autoIncrement: false,
      comment: '修改时间',
      field: 'update_time',
    },
  }
  const options = {
    tableName: 'fence_sub_table',
    comment: '',
    indexes: [],
    createdAt: 'create_time',
    updatedAt: 'update_time',
  }
  const FenceSubTableModel = sequelize.define(
    'fence_sub_table_model',
    attributes,
    options
  )
  return FenceSubTableModel
}
